package com.web.model;

public class ResponseData {
	private int code;//响应状态码
	private String msg;//响应信息
	private Object data;//响应内容
	
	
	public  ResponseData() {}	;
	public ResponseData(int code,String msg,Object data) {
		this.code=code;
		this.msg=msg;
		this.data=data;
	}
	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public Object getData() {
		return data;
	}
	public void setData(Object data) {
		this.data = data;
	}
	
	public void success(String msg,Object data) {
		this.code = 200;
		this.msg = msg;
		this.data = data;
	}
	public void success(String msg){
		this.code = 200;
		this.msg = msg;
		
	}
	
	
	//某种情况下，表示请求失败，只需要传入msg
	public void failed(String msg) {
		this.code = 500; //请求失败的状态码
		this.msg = msg;
	
	}
	//鉴权无效时的返回
	public void notAuth() {
		this.code=403;
		this.msg="访问失败，该用户token已失效";
	}
	

}
